/* 代码预览容器样式 */
.code-preview-container {
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 代码语法高亮样式 */
.code-highlight {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
    max-height: 400px;
    overflow-y: auto;
}

.code-highlight.python {
    background: #f6f8fa;
}

.code-highlight.javascript {
    background: #fffbf0;
}

.code-highlight.java {
    background: #f0f4ff;
}

.code-highlight.cpp {
    background: #fff0f5;
}

.code-highlight.typescript {
    background: #f0f8ff;
}

.code-highlight.lua {
    background: #f5f0ff;
}

/* 语法高亮颜色 */
.code-highlight .keyword {
    color: #d73a49;
    font-weight: bold;
}

.code-highlight .string {
    color: #032f62;
}

.code-highlight .comment {
    color: #6a737d;
    font-style: italic;
}

.code-highlight .number {
    color: #005cc5;
}

.code-highlight .function {
    color: #6f42c1;
    font-weight: bold;
}

.code-highlight .class {
    color: #e36209;
    font-weight: bold;
}

.code-highlight .variable {
    color: #24292e;
}

.code-highlight .operator {
    color: #d73a49;
}

/* 代码差异对比样式 */
.code-diff {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    overflow: hidden;
}

.code-diff-header {
    background: #f6f8fa;
    padding: 8px 16px;
    border-bottom: 1px solid #d1d5da;
    font-weight: bold;
    color: #586069;
}

.code-diff-line {
    padding: 2px 16px;
    white-space: pre;
    border-left: 4px solid transparent;
}

.code-diff-line.added {
    background: #e6ffed;
    border-left-color: #28a745;
}

.code-diff-line.removed {
    background: #ffeef0;
    border-left-color: #d73a49;
}

.code-diff-line.unchanged {
    background: #fff;
}

.code-diff-line-number {
    display: inline-block;
    width: 50px;
    color: #586069;
    text-align: right;
    margin-right: 16px;
    user-select: none;
}

/* 代码版本历史样式 */
.code-version-history {
    border: 1px solid #d1d5da;
    border-radius: 6px;
    overflow: hidden;
}

.code-version-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e1e4e8;
    background: #fff;
}

.code-version-item:last-child {
    border-bottom: none;
}

.code-version-item:hover {
    background: #f6f8fa;
}

.code-version-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.code-version-info {
    font-size: 14px;
    font-weight: bold;
    color: #24292e;
}

.code-version-date {
    font-size: 12px;
    color: #586069;
}

.code-version-message {
    font-size: 13px;
    color: #586069;
    margin-bottom: 8px;
}

.code-version-stats {
    font-size: 12px;
    color: #586069;
}

/* 代码预览工具栏 */
.code-preview-toolbar {
    background: #f6f8fa;
    border-bottom: 1px solid #d1d5da;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-preview-language {
    font-size: 12px;
    color: #586069;
    font-weight: bold;
}

.code-preview-actions {
    display: flex;
    gap: 8px;
}

.code-preview-btn {
    background: linear-gradient(135deg, #0366d6, #0256cc);
    border: 1px solid #0366d6;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: #ffffff;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(3, 102, 214, 0.2);
}

.code-preview-btn:hover {
    background: linear-gradient(135deg, #0256cc, #024ea4);
    border-color: #0256cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(3, 102, 214, 0.3);
    color: #ffffff;
    text-decoration: none;
}

/* 模态框样式 */
.diff-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diff-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.diff-modal-container {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 90vw;
    max-height: 90vh;
    width: 1000px;
    display: flex;
    flex-direction: column;
}

.diff-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.diff-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #586069;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.diff-modal-close:hover {
    background: #f6f8fa;
    color: #24292e;
}

.diff-modal-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.diff-header {
    margin-bottom: 20px;
}

.diff-header h3 {
    margin: 0 0 16px 0;
    color: #24292e;
    font-size: 18px;
}

.version-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.version-item {
    padding: 12px;
    background: #f6f8fa;
    border-radius: 6px;
    border: 1px solid #d1d5da;
}

.version-item strong {
    display: block;
    color: #24292e;
    margin-bottom: 4px;
}

.version-item span {
    color: #586069;
    font-size: 12px;
}

.commit-msg {
    margin-top: 8px;
    font-size: 13px;
    color: #586069;
    font-style: italic;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #586069;
    font-size: 14px;
}

.error {
    text-align: center;
    padding: 40px;
    color: #d73a49;
    font-size: 14px;
    background: #ffeef0;
    border: 1px solid #fdaeb7;
    border-radius: 6px;
}

/* 全屏代码预览样式 */
.code-preview-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: white;
    display: flex;
    flex-direction: column;
}

.code-preview-container.fullscreen .code-highlight {
    flex: 1;
    max-height: none;
    border-radius: 0;
}

.code-preview-container.fullscreen .code-preview-toolbar {
    border-radius: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .code-highlight {
        font-size: 12px;
        padding: 12px;
    }
    
    .code-diff-line {
        padding: 2px 8px;
    }
    
    .code-diff-line-number {
        width: 30px;
        margin-right: 8px;
    }
    
    .code-version-item {
        padding: 8px 12px;
    }
    
    .diff-modal-container {
        width: 95vw;
        max-height: 95vh;
    }
    
    .version-info {
        grid-template-columns: 1fr;
    }
    
    .diff-modal-content {
        padding: 12px;
    }
}